<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<button id="open">打开</button>
     <a href="http://www.baidu.com" target="haha"></a>

     <button id="openWindow">打开窗口</button>
     <button id="closeWindow">关闭窗口</button>
</body>
</html>
<script>
	var openBtn = window.document.getElementById("open");
	openBtn.onclick = function(){
		window.open("http://www.baidu.com","haha","width=600,height=600,left=100, top=200, scollbars=no, toolbar=yes");
	};

	var newWindow;
	openWindow.onclick = function(){
		newWindow = open("","","w idth=500,height=500");
		newWindow.onload = function(){
			var div = newWindow.document.createElement("div");
			div.style.width = "200px";
			div.style.height = "200px";
			div.style.background = "red";
			newWindow.document.body.appendChild(div);
		};
	};

</script>